#!/bin/bash

# put the script into the project root dir

# ssh-keygen -t rsa -f ~/.ssh/remote_key
# ssh-copy-id -i ~/.ssh/remote_key.pub remote_user@remote_host

remote_hostname='remote_host'
remote_relative_path='/to/project/path'

cd $(dirname $0)

if [[ 'upload' == $1 ]]
then
    rsync -azcul --exclude '.git' --relative "$2/$3" "$remote_hostname:$remote_relative_path"
elif [[ 'download' == $1 ]]
then
    rsync -azcul --exclude '.git' "$remote_hostname:$remote_relative_path/$2/$3" "$2/$3"
fi

cd -
